﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Customer_MemoDay_Remand.aspx.cs" Inherits="JKF.Web.SMS.Remind.Customer_MemoDay_Remand" %>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">
        #dayView label { margin-right: 8px; }
    </style>
    <%= RegScript("~/js/jquery.1.5.js")%>
    <%= RegScript("~/js/jquery.nhis.js")%>
    <%= RegScript("~/js/jquery.rchis.js")%>
    <%= RegScript("~/js/jquery-ui-custom.min.js")%>
    <%= RegScript("~/js/jquery.json.js")%>
    <%= RegScript("~/js/css.js")%>
    <%= RegScript("~/js/DatePicker/WdatePicker.js")%>
    <%= RegScript("~/js/Common.js")%>
    <%= RegScript("~/js/Jquery.commonGrid.js")%>
    <%= RegStyle("~/App_Themes/Theme2/Include.css")%>
    <script type="text/javascript">
        var AppPath = '<%=AppPath %>';
        var handler = AppPath + '/do/SMS/SmsModule.do';
        var tmpl = new DTemplate();
        var PageSize = 20;
        var sendSms = "<%=PSendSms%>";
        var pager = null;
        var advSearch = null;
        var rowTemplate = "<tr pk=\"${CUSTOMER_KEY}\" mbl=\"${MOBILE}\"><td><input type=\"button\" class=\"op-view mr12 btn_style\" style=\"display:<%=PSendSmsLog%>;\" value=\"查看发送日志\"/><input type=\"button\" class=\"op-send mr12 btn_style\" style=\"display:${CanSend};\" value=\"发送短消息\"/></td><td>${CARD_NO}</td><td>${NAME}</td><td>${MOBILE}</td><td>${DATEG}</td><td>${DATEY}</td><td>${ACTDATE}</td><td>${SMS_DATE}</td><td>${PHONE_DATE}</td></tr>";
        $(function () {
            pager = $('#divPager').pager(AppPath, handler, function () {
                return {
                    ActionName: 'GetMemoDayRemand',
                    dayVal: $("#dayView :checked").val()
                };
            }, function (data) {
                var tbody = $('#tb tbody');
                tbody.empty();
                if (data && data.Entity && data.Entity.length) {
                    $(data.Entity).each(function () {
                        this.CanSend = /^\d{6,15}$/.test(this.MOBILE) ? "" : "none";
                        if (this.CanSend == "" && sendSms != "") this.CanSend = "none";
                    });
                    tbody.html(tmpl(rowTemplate, data.Entity, true));
                } else {
                    tbody.html('<tr><td colspan="9" style="text-align: center">没有数据!</td></tr>');
                }
                $("#tb").H8_Grid($("#divPager"), (function () { var tbHeight = $(window).height() - 35; tbHeight -= ($(".common_search").size() > 0) ? $(".common_search").eq(0).height() : 0; tbHeight -= ($("#divPager").size() > 0) ? $("#divPager").height() : 0; return tbHeight < 300 ? 300 : tbHeight; })());
            }, PageSize, true);
            BindGridEvent();

            $('#btnSearch').click(function () {
                advSearch = null;
                pager.option.pageIndex = 1;
                pager.getPegerData();
                return false;
            }); $("#btnSendAll").click(SendAll);
        });

        function BindGridEvent() {
            $(':button.op-send').live('click', function () {
                var mobile = $.FxNull($(this).parent().parent().attr("mbl"), "");
                if (/^\d{6,15}$/.test(mobile)) SendSms(mobile);
            });
            $(':button.op-view').live('click', function () {
                window.parent.pop("查看发送记录", '<%= ResolveUrl("~/SMS/Sms_Customer_View.aspx?customerKey=")%>' + $.FxNull($(this).parent().parent().attr("pk"), ""), 800, 500);
            });
        }

        function SendAll() {
            var mobiles = [];
            $("#tb>tbody").find("tr[mbl]").each(function () {
                var vl = $.FxNull($(this).attr("mbl"), "");
                if (vl.length > 0 && /^\d{6,15}$/.test(vl)) mobiles.push(vl);
            });
            SendSms(mobiles.join(","));
        }
        function SendSms(mbl) { window.parent.pop("发送短信", '<%= ResolveUrl("~/SMS/Remind/SendRemandSms.aspx?mobile=") %>' + $.FxNull(mbl, ""), 800, 500); }
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <div class="warrper_body">
            <div class="index">
                <div class="common_search">
                    <div class="l_h45" id="dayView">
                        <label>
                            <input type="radio" name="dayView" value="0" checked="checked" />当日提醒</label>
                        <label>
                            <input type="radio" name="dayView" value="3" />提前3天提醒</label>
                        <label>
                            <input type="radio" name="dayView" value="5" />提前5天提醒</label>
                        <label>
                            <input type="radio" name="dayView" value="7" />提前7天提醒</label>
                        <label>
                            <input type="radio" name="dayView" value="15" />提前15天提醒</label>
                        <label>
                            <input type="radio" name="dayView" value="30" />提前30天提醒</label>
                        <input id="btnSearch" type="button" value="" class="common_btn_search" />
                        <input id="btnSendAll" type="button" value="" onclick="SendAll();" class="btn_fasong3" style="display: <%=PSendAllSms%>;" />
                    </div>
                </div>
                <div class="l_h7"></div>
                <div class="index_table">
                    <table id="tb" class="common_table">
                        <thead>
                            <tr>
                                <th width="190px" orderaction="false">操作
                                </th>
                                <th width="100px" ordertype="string">卡号
                                </th>
                                <th width="150px" ordertype="string">姓名
                                </th>
                                <th width="100px" ordertype="string">手机
                                </th>
                                <th width="200px" ordertype="string">时间（农）
                                </th>
                                <th width="100px" ordertype="string">时间（公）
                                </th>
                                <th width="100px" ordertype="string">纪念日
                                </th>
                                <th width="100px" ordertype="string">最近发短信日期
                                </th>
                                <th width="100px">最近通话日期
                                </th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td colspan="9" style="text-align: center">点击搜索查看数据
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                <div class="page" id="divPager">
                </div>
            </div>
        </div>
    </form>
</body>
</html>
